package com.example.gerenciadorestudo;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.ListView;

public class NovaMateria extends Activity {
	EditText etNome;
	EditText etCodigo;
	EditText etHoraInicio;
	EditText etHoraFim;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_nova_materia);
		
		etNome = (EditText) findViewById(R.id.editTextNome);
		etCodigo = (EditText) findViewById(R.id.editTextCodigo);
		etHoraInicio = (EditText) findViewById(R.id.editTextHoraInicio);
		etHoraFim = (EditText) findViewById(R.id.editTextHoraFim);
		
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_nova_materia, menu);
		return true;
	}
	
	public void cadastrar(View v){
		String nome = etNome.getText().toString();
		String codigo = etCodigo.getText().toString();
		String horaInicio = etHoraInicio.getText().toString();
		String horaFim = etHoraFim.getText().toString();
		
		
		Materia materia = new Materia(nome, codigo, horaInicio, horaFim);
		MainActivity.banco.inserirMateria(materia);
		finish();
	}

}
